package middleware;

import java.util.concurrent.ConcurrentLinkedQueue;

// concurrent queue with restricted access from handlers and logic 
public class Queue {
	private ConcurrentLinkedQueue<ClientHandler> queue;
	
	public Queue() {
		queue = new ConcurrentLinkedQueue<ClientHandler>();
		
	}
	
	public void add(ClientHandler ch) {
		queue.add(ch);
//		System.out.println("queue size: "  +  queue.size());
	}
	
	public ClientHandler remove() {
		return queue.remove();
	}
	
	public ClientHandler first() {
		return queue.peek();
	}
	
	public Integer size() {
		return queue.size();
	}
	
	public boolean isEmpty() {
		return queue.isEmpty();
	}
}
